package com.jy.travel.utils
{
	public class SecurityCommon
	{
		
		public static var username:String = "";
		
		public static var realname:String = "";
		
		public static var companyname:String = "";
		
		public static var companyrole:String = "";
		
		private static var authorityArray:Array = new Array();
		
		public function SecurityCommon()
		{
		}
		
		public static function get authority():Array {
			return authorityArray;
		}
		
		public static function initAuthority(array:Array):void {
			for (var i:int=0; i<array.length; i++) {
				var authority:Object = analyseAuthority(array[i]);
				authorityArray.push(authority);
			}
			array = null;
		}
		
		private static function analyseAuthority(obj:Object):Object {
			var authority:Object = new Object();
			// 分析权限 按照正常的业务模块来分析 
			// 最后添加属性 className functionName moduleName 
			if (obj.moduleFunction == "moduleFunction1") {
				authority.className = "com.jy.travel.module.CompanyModule";
				authority.functionName = "旅行社账号";
				authority.moduleName = "旅行社账户维护";
			} else if (obj.moduleFunction == "moduleFunction2") {
				authority.className = "com.jy.travel.module.CompanyModule2";
				authority.functionName = "旅行社账号2";
				authority.moduleName = "旅行社账户维护2";
			}
			
			return authority;
		}

	}
}